import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  //app.enableCors({
  //  origin: true,
  //  credentials: true,
  //});
  const options = new DocumentBuilder()
    .setTitle('网上书城-API文档')
    .setDescription('使用nestjs+mongodb制作的api接口文档')
    .setVersion('1.0')
    .addBearerAuth()
    .build();
  const document = SwaggerModule.createDocument(app, options);
  SwaggerModule.setup('api-docs', app, document);
  await app.listen(80);
}
bootstrap();
